package fag.core.game.test.arkanoid;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;

import fag.core.game.StandardDoodad;
import fag.core.geometry.Vector2D;

public class Bonus extends StandardDoodad {

	public enum Type {
		Blue,
		Brown,
		Green,
		Grey,
		Purple,
		Red,
		Yellow
	}
	public Vector2D speed = new Vector2D(150, 150);
	
	private static final List<Type> VALUES = Collections.unmodifiableList(Arrays.asList(Type.values()));
	private static final int SIZE = VALUES.size();
	private static final Random RANDOM = new Random();
	
	Type type;
	
	
	public Bonus() {
		super(new BonusModel());
		type = VALUES.get(RANDOM.nextInt(SIZE));
		setCorrectAnimation();
	}
	
	public Bonus(Type type) {
		super(new BonusModel());
		this.type = type;
		setCorrectAnimation();
	}

	public Type getType() {
		return type;
	}
	
	public void step(double dt) {
		translate(0, speed.y * dt, Referential.ABSOLUTE);
	}
	
	private void setCorrectAnimation() {
		
		switch(type) {
		case Blue:
			setAnimation("blue");
			break;
		case Brown:
			setAnimation("brown");
			break;
		case Green:
			setAnimation("green");
			break;
		case Grey:
			setAnimation("grey");
			break;
		case Purple:
			setAnimation("purple");
			break;
		case Red:
			setAnimation("red");
			break;
		default:
			setAnimation("yellow");
		}
	}
}
